package syncon;

import com.google.gdata.client.contacts.ContactsService;

public class Syncon {
	
	public static String userName;
	public static ContactsService googleService;
	public static enum SynconError {
		FATAL_ERROR(1, "A Fatal Error Has Occured"), INVALID_ARGUMENTS(2,
				"Invalid Arguments"), INVALID_SERVICE(3, "Invalid Service Name");

		private final Integer code;
		private final String msg;

		private SynconError(Integer code, String msg) {
			this.code = code;
			this.msg = msg;
		}

		private Integer getErrorCode() {
			return code;
		}

		private String getErrorMessage() {
			return msg;
		}

		public void errorExit() {
			System.out.println(this.getErrorMessage());
			System.exit(this.getErrorCode());
		}
	};

	public static enum SynconService {

		FBPHOTO(1, "Update Photos From Facebook");

		private final Integer serviceCode;
		private final String serviceDescription;

		private SynconService(Integer serviceCode, String serviceName) {
			this.serviceCode = serviceCode;
			this.serviceDescription = serviceName;
		}

		public Integer getServiceCode() {
			return serviceCode;
		}

		public String getServiceDescription() {
			return serviceDescription;
		}

		public static SynconService getService(String serviceName) {
			if (serviceName.toUpperCase().equals("FBPHOTO")) {
				return SynconService.FBPHOTO;
			} else {
				SynconError.INVALID_SERVICE.errorExit();
				return null;
			}
		}
	}

}
